<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // a 的默认值为1；b的默认值为2
        let [a=1, b=2] = [3];
        // 数组不完全解构，a被重新赋值为3，b默认值为2
        console.log(a, b); // 3 2

        // null 不等于undefined
        let [a2=1, b2=2] = [3, null];
        console.log(a2, b2); // 3 null
        console.log('----------');

        // TODO
        /**
         * 在等号右边只要是undefined，就要取默认值
        */
        let [a3=1, b3=2] = [3, undefined];
        console.log(a3, b3); // 3 2

    </script>
</head>
<body>
    
</body>
</html>